-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't require cargo update
when bumping versions
#5215
Conversation
r? @matklad (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
tests/testsuite/update.rs
Outdated
) | ||
.build(); | ||
|
||
assert_that(p.cargo("build").env("RUST_LOG", "cargo=trace"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for .env
?
tests/testsuite/update.rs
Outdated
name = "bar" | ||
version = "0.2.0-alpha" | ||
authors = [] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line
src/cargo/ops/resolve.rs
Outdated
let mut avoid_locking = HashSet::new(); | ||
for node in resolve.iter() { | ||
if !keep(&node) { | ||
add_deps(resolve, node, &mut avoid_locking); | ||
} else if node.source_id().is_path() { | ||
if let Ok(path) = node.source_id().url().to_file_path() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it makes sense to somehow reshuffle utility methods, so as to avoid if is_path() { url().to_file_path() }
pattern
One historical annoyance I've always had with Cargo that I've found surprising is that in some situations when you bump version numbers you'll have to end up running `cargo update` later on to get everything to build. You get pretty wonky error messages in this case as well saying a package doesn't exist when it clearly does at a particular location! I've had difficulty historically nailing down a test case for this but it looks like we ironically already had one in our test suite and I also jury-rigged up one from a case I ran into in the wild today.
c9a1030
to
0deaae9
Compare
@bors: r=matklad |
📌 Commit 0deaae9 has been approved by |
Don't require `cargo update` when bumping versions One historical annoyance I've always had with Cargo that I've found surprising is that in some situations when you bump version numbers you'll have to end up running `cargo update` later on to get everything to build. You get pretty wonky error messages in this case as well saying a package doesn't exist when it clearly does at a particular location! I've had difficulty historically nailing down a test case for this but it looks like we ironically already had one in our test suite and I also jury-rigged up one from a case I ran into in the wild today.
☀️ Test successful - status-appveyor, status-travis |
Discovered in rust-lang#5257 the changes in rust-lang#5215 were slightly too aggressively poisoning sources to require updates, thinking that a manifest changed when it actually hadn't. Non-workspace-member path dependencies with optional/dev-dependencies don't show up in the lock file, so the previous logic would recognize this and think that the dependency missing from the lock file was just added and would require a registry update. The fix in this commit effectively just skips all of these dependencies in non-workspace members. This means that this will be slightly buggy if an optional dependency that's activated is added, but that's hopefully something we can tackle later. Closes rust-lang#5257
Less aggressively poison sources on builds Discovered in #5257 the changes in #5215 were slightly too aggressively poisoning sources to require updates, thinking that a manifest changed when it actually hadn't. Non-workspace-member path dependencies with optional/dev-dependencies don't show up in the lock file, so the previous logic would recognize this and think that the dependency missing from the lock file was just added and would require a registry update. The fix in this commit effectively just skips all of these dependencies in non-workspace members. This means that this will be slightly buggy if an optional dependency that's activated is added, but that's hopefully something we can tackle later. Closes #5257
Discovered in rust-lang#5257 the changes in rust-lang#5215 were slightly too aggressively poisoning sources to require updates, thinking that a manifest changed when it actually hadn't. Non-workspace-member path dependencies with optional/dev-dependencies don't show up in the lock file, so the previous logic would recognize this and think that the dependency missing from the lock file was just added and would require a registry update. The fix in this commit effectively just skips all of these dependencies in non-workspace members. This means that this will be slightly buggy if an optional dependency that's activated is added, but that's hopefully something we can tackle later. Closes rust-lang#5257
One historical annoyance I've always had with Cargo that I've found surprising
is that in some situations when you bump version numbers you'll have to end up
running
cargo update
later on to get everything to build. You get pretty wonkyerror messages in this case as well saying a package doesn't exist when it
clearly does at a particular location!
I've had difficulty historically nailing down a test case for this but it looks
like we ironically already had one in our test suite and I also jury-rigged up
one from a case I ran into in the wild today.